using MvcMall.Core.Domains;
using MvcMall.Portal.Controllers.Stores.ViewModels;

namespace MvcMall.Portal.Controllers.Stores.Mappers
{
    public class StoreCategoryDomainToSaveModelMapper
    {
        public SaveStoreCategoryModel MapFrom(StoreCategory input)
        {
            var model = new SaveStoreCategoryModel
                            {
                                CatName = input.CatName,
                                Id = input.Id,
                                ParentId = input.ParentCat == null ? 0 : input.ParentCat.Id,
                                ParentName = input.ParentCat == null ? string.Empty : input.ParentCat.CatName,
                                SortOrder = input.SortOrder
                            };
            return model;
        }
    }
}